# 爬取搜狗首页的页面数据

import requests

if __name__ == "__main__":
    # 1. 指定url
    url = 'https://www.sogou.com/'
    # 2. 发起请求
    response = requests.get(url=url)
    # 3. 获取相应数据
    # response.text 属性获取响应数据的字符串形式，并将其打印出来
    page_text = response.text   #
    print(page_text)
    # 4. 存储到文件中
    with open('sogou.html', 'w', encoding='utf-8') as fp:
        fp.write(page_text)
    print('--爬取数据结束--')
